# -*- coding: utf-8 -*-
import urllib2, re

def getHttpData(url):
    req = urllib2.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
    response = urllib2.urlopen(req)
    httpdata = response.read()
    response.close()
    return httpdata

def getHttpDataCompact(url):
    httpdata = getHttpData(url)
    httpdata = re.sub("\s", "", httpdata)
    return httpdata

html = getHttpDataCompact('http://v.qq.com/movie/type/list_9_-1_1_0_1.html')

match = re.compile('<ahref="[^"]+"class="_gtag"tvalue="([^"]+)"title="([^"]+)">([^<]+)</a>').findall(html)
index = 0;    
while index < len(match):    
    print '\'' + match[index][1] + '\' : \'' + match[index][0] + '\','
    index = index + 1
        